/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.itriage.hospital.app.factory;

import com.itriage.hospital.model.Department;
import com.itriage.hospital.model.PasswordEncrypt;
import com.itriage.hospital.model.Roles;
import com.itriage.hospital.model.Users;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Yandiswa
 */
public class UserAppfactory {
    
       public static Roles creatRoles(String roll,Users users) {
        Roles roles = new Roles();
        roles.setRoleName(roll);
        roles.setUsers(users);
       return roles;
        
    }
    public static Users creatUsers(Map<String, String> values,List<Roles> roles) {
        Users users = new Users();
        users.setEnabled(true);
        users.setPassword(PasswordEncrypt.encrypt(values.get("password")));
        users.setRoles(roles);
        users.setUsername(values.get("userName"));
       
        return users;
        
    }
}
